"""api_to_react URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from help_api.views import add_help_card
from login_api.views import getInfos, Register, Login
from card_api.views import RecordCard, GetCardInfos, GetLikesInfos, \
    UpdateLikesStateAndNumber, AddCollection, GetUserCollectionInfos, CommentAPI

urlpatterns = [
    path('admin/', admin.site.urls),
    path('api/help', add_help_card),
    path('api/getInfos', getInfos),  # 获取用户信息，用于判断是否重复用户名
    path('api/register', Register),  # 注册api，接受前端提交的表单数据
    path('api/login', Login),    # 登陆api，用户验证登陆是否成功
    path('api/card', RecordCard),  # 发布api，发布灵感卡片
    path('api/find', GetCardInfos),  # 查询卡片信息的api
    # path('api/find/<int:card_id>', GetCardInfos),  # 查询卡片信息的api
    path('api/user-likes', GetLikesInfos),  # 查询当前用户点赞的api
    path('api/update-likes', UpdateLikesStateAndNumber),  # 更新用户点赞状态的api
    path('api/update-collections', AddCollection),  # 更新用户收藏状态的api
    path('api/get-user-collections', GetUserCollectionInfos), # 获取用户收藏的API
    path('api/add-comments', CommentAPI),  # 添加评论的api
]
